package com.senney.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

/**
 * @Author lanmengye@outlook.com
 * @Date 2020/12/29 22:12
 */
public class FileChannel04 {
    public static void main(String[] args) throws Exception{
        FileInputStream inputStream = new FileInputStream("D:\\git01.png");
        FileOutputStream outputStream = new FileOutputStream(("D:\\git02.png"));

        FileChannel src = inputStream.getChannel();
        FileChannel dest = outputStream.getChannel();
//        dest.transferFrom(src,0,src.size());
        src.transferTo(0,src.size(),dest);

        inputStream.close();
        outputStream.close();
    }
}
